<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.List" %>
<%@ page import="my.market.jdbc.dataClass.Goods" %>
<%@ page import="my.market.jdbc.dao.GoodsDao" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%	List<Goods> goods = (List<Goods>) request.getSession().getAttribute("cart");
%>
<html>
<head>
<title>购物车</title>
<link type="text/css" href="${pageContext.request.contextPath }/pageDisplay/css/main.css" rel="stylesheet" />
</head>
<body class="main">
<%@include file="head.jsp" %>
<div class="content">
<table>
	<tr>
		<td><%@include file="category.jsp" %></td>
		<td><%@include file="search.jsp" %></td>
	</tr>
</table>
</div>
<div class="content">
<% if(goods == null || goods.size() == 0 ){ %>
<p>你的购物车空空如也</p>
<% }else{ %>
	<c:forEach var="good" items="<%=goods %>">
		<li>
			<table>
				<tr>
					<td><a href="${pageContext.request.contextPath}/pageDisplay/goodDetail.jsp?id=${good.getId()}">${good.getName()}&nbsp;&nbsp;&nbsp;</a></td>
					<td>${good.getType()}&nbsp;&nbsp;&nbsp;</td>
					<td>${good.getDescription() }</td>
					<td>${good.getPrice()}元</td>
					<td><a href="${pageContext.request.contextPath}/removeCart?id=${good.getId() }"><button type="button">从购物车移除</button></a></td>
				</tr>
			</table>
		</li>
	</c:forEach>
	<a href="${pageContext.request.contextPath }/createOrder" ><button type="button">购买支付</button></a>
<% } %>
</div>
<%@include file="foot.jsp" %>
</body>
</html>